import { defineStore } from 'pinia'
import { getAreaPage, saveArea } from '../api/area'

export const useAreaStore = defineStore('area', {
  state: () => ({
  }),
  actions: {
    getAreaPage(params: any): Promise<any> {
      return new Promise((resolve, reject) => {
        getAreaPage(params)
          .then((res:any) =>{
            resolve(res)
          })
          .catch(err => reject(err))
      })
    },
    saveArea(params: any): Promise<any> {
      return new Promise((resolve, reject) => {
        saveArea(params)
          .then((res:any) =>{
            resolve(res)
          })
          .catch(err => reject(err))
      })
    },
  },
})